import { _decorator, Button, Component, Node, tween, UIOpacity } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BeginItem')
export class BeginItem extends Component {
    @property(Button) btnStart: Button = null;
    @property(UIOpacity) light: UIOpacity = null;

    public onBegin: Function = null;

    start() {
        tween(this.light)
            .to(1, { opacity: 125 })
            .to(1, { opacity: 255 })
            .union()
            .repeatForever()
            .start();

        this.btnStart.node.on(Button.EventType.CLICK, () => {
            this.onBegin?.();
        }, this);
    }
}


